some fixes and a bit performance optimization