fix indexing error in purify engine