Added error checking for sign in and registering