Attempt to fix possible race condition.