Small bugfixes

PR for some straighforward bugfixes.