small test refactorings & minor bug fixes