fixed _detect_diff_format