Fixed a bug in fileref upload error handling