fixing login function