Better debugging output.
Added a unit test that locates the problem! :D