logging + bugfix