-- worked on CRM-12127

Did changes as per mentioned in comment for CRM-12127
http://issues.civicrm.org/jira/browse/CRM-12127?focusedCommentId=49281&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-49281