fix things that were either screwed up by the rebase, or were new code
added in the 2 months since I originally submitted the pull request