Fix a bug in diff. Fixes checkout issue.
Added comments.