Fixed a couple of bugs introduced during #464