Fixed compilation on Windows.
Merge branch 'winfixes' into work
Fixed some errors.