optimizations and bugfixes