Bugfixes to compile