bug fixes
refactored tests