various bugfixing work

more bugfixing