Fix file upload errors when run via supervisor