Fixing dumb bugs uncovered by a unit test