added error handling for both signup and login