Fixed some more bugs in the test code