Fix for race condition