removed race condition