fixing error on login function