performance improvements, bugfixes