fixed upload error handling