bugfixes caught by unit testing!  w00t!