Fixed a couple of silly but nasty bugs