Fixed login race condition