Fix login function.