Fixed bugs in login