Prevent Python 3 specific (?) race condition