fixed alerts and error messaging