Fix diff function context trimming