various bugfixing