Fixed a couple of bugs introduced by the last change.