Fix some bugs of diff