Bug fixes to the diff implementation.