removed possible race condition