a lot of small bugfixes