refactored
bugfix from refactoring