Fixes #5495: upgrade on 2.11 does not end correctly

I took advantage of this Pull Request to fix the error message that was displayed wrongly (see Redmine ticket). I don't consider this an unrelated change, since we're fixing the cause for the error and the error message here at the same time.