Fix mistakes made in commit 23dc44df

(reverting the whole earlier commit was more work)