bug fixes and test refactoring