refactoring, minor bugfix