Fix bugs on diff