Various changes to make compilation less painful on linux