Fix diff context logic