Added login and register error handler