Fixing failing tests

A bunch of tests was in bad shape and the test suite didn't pass by a long shot. This makes me doubt that anything is driven by tests, especially the development.