Modified the script to work on Windows under msys