Tweak previous commit to avoid threading race conditions