fix a couple of bugs