improve login function and modify bug