fix file upload bugs