login race condition fix