Fix various mistakes in the test suite
Merge branch 'tests-fix'