worked out a couple of bugs