My patches for apgdiff