code refactoring - bugfix