And now I have a work around. There is something called Android deep sleep bug which is the cause of error in alarm functionality. When the phone is in deep sleep the OS does not wake up to raise the alarm. The solution is there is a parameter called wake lock, just has to be changed to not suspend. I am not an Android programmer so I installed a free app 'Load Monitor', which has an option of wake Suspend, just tick it and it will not allow your phone to deep sleep. It is pretty useless app but then your alarm clock will be reliable. This app does consume some battery, so I kill it when no alarm is required, and enable it again before setting the alarm and keep it on till alarm rings and I am awake. All the functionality of alarm works flawlessly.