Fixed cygwin compatibility (issue #806)

Fixed platform specific issues causing cygwin build to fail.

Applied fix found during discussion about issue #806 .