Bugfixes

Some bugfixes