login function corrections