Merge "Fix the bug that it should write the zero diff to the output file when the actual diff is negative."