Fix login fail and repeat bug