Gentoo bug fixes

this should all bugs on gentoo systems (found by @TheSiege)