Fixes for cygwin

no clue if this breaks anything on linux.