some bug fixes and performance boosting
much bugfixes and changes