Bugfixes for test cases