fix tests.

This does not make the tests pass, but solves a lot of misc. issues.
please merge :)