diff: write prefix to the correct file