fixes
Great bugfixes and some improvements