added some OS ifdefs, dunno if they work