Fix Windows compatibility issues

This pull request is based on the merge-fixes branch (pull request #95).