fix windows build problems, courtesy of andreyto