Added error checking in the authentication window.