Bugfixesonly

This branch consists of bugfixes only, it should be straightforward to merge it in cleanly.