Fix a couple of bugs introduced in last commit