Testfixes and tidy ups