Fix tree construction on Windows