add error check in login