small bugfixes & optimizations