Fixed save_login function