More bugfixes, including a rather nasty one that I should have solved a long time ago...
And the other bugfix that I missed... silly git