bugfix on the refactor