fixed logical errors related to login