more messing around with ifdefs to get it to compile on all platforms