File uploading bug fixes