fix for race condition where files were disappearing