Bug fix in the login handler