#31 fix new bug introduced after refactoring