fix windows build errors and warnings