bug fixes in merging pages