logging and bugfixes