debug statements and bugfixes