Compatibility fixes

Everything that was necessary to compile without errors on gentoo.