Darwin

Some fixes to make it build on old Darwin too (i.e.. Mac OS X 10.6 and earlier)