fix bug where error handling for uploads does not work properly