Bugfixes

Fix a few minor bugs