bug fixes from Nick for windows compile