fix and add test case for diff command