code fixes for compiling on different OSes