fix handling of uploaded file