Various small fixes

please refer to the commit messages