a lot of bugfixes