Added more tests, fixed yet another subtle class bug revealed by the same.