various bugfixes