Fix a couple of bugs introduced in 6359b23