made login threadsafe (kinda)