fixed the exceptions thrown when an Alert box is showed