file upload fixes + cleanup