fixing a couple of bugs