Fix several bugs in the test refactor, and adjust some assumptions