fix windows build

+ fix some cast warnings