Added extra guard when doing the diff