Bugfixes for various things