Fixed wrong error logging in upload