committing a mess of possible bugfixes...