fix resultIndex bug (closes #1216)