refactor, bugfix