Fixed a couple of bugs left over from refacforing