More tests and fixes in test framework