Fix error 500 handling during upload process.