more bugfix / refactor