misc bug fixes due to refactoring