fix file parsing race condition