Trying to solve login loop