More bugfixes (this is not very easy to test)