fixed error handling for login/register