minor bug fixes and hide the keyboard before showing the alert