Bugfixes

Fixed some bugs