partially fixed indexing issues in pmerge