patch for mac and linux
fixed linux->arm cross compilation
unset instead of set 0, might avoid problems
simplified if/then/else