Fixed some bugs in the test framework