First commit

Fix race condition.