Fixes to compile and work on both linux and windows