Bugfixes

several small bugfixes