various bugfixes

various bugfixes