refactor bugfix