Fixing a couple of bugs