small cleanup and bugfixing