Fixing race conditions.