bug fixes
refactoring