a couple of refactoring fixes