Adapt unit tests to new interface and fix encountered bugs