bugfixes, performance improvements