Various bugfixes, make things compile again.