Fix some windows bugs, wrong function name