various fixes for file upload