Fixed bugs in login sequence.
Now we can login or be denied access, which is good for once.