Fix the function of login