Small bugfixes in several places