fix race condition on uploaded file