File upload bug fixes