Bugfixes

a few bugfixes