Bugfixes, see commits