added windows support, minor bug fix