Fix upload error handling