patch a couple of bugs