De-duplicate pages in replaceInternal

Change-Id: If534308040201f0c4f9d315fae508c7dd3f53ee9
Merge "De-duplicate pages in replaceInternal"