bugfixes

a lot of bugfixes