bugfix + logging