refactoring bug fixes