several bugfixes