Fixed Some bugs with logging in and out