fixed race condition in file adding
fixed race condition in file adding