Fixed cross-platform issues on OSX and Linux, cygwin still up in the air