Fixed up a couple of bugs