Fix the swapping of indexes of reversed parents.

There was a typo in the statement doing the index swapping.