added lots of unittests and while I was at it, fixed a couple of bugs in the
backend modules.