login function modified