fixed race condition for login