Fix crash in gradfun:end_frame() when inpic == outpic, so it has to be