Fix some windows bugs