fixed problems with Makefile on x86_64, patches from gentoo added