fixed false test condition if index exists.
Merge pull request #1320 from veroc/hotfix/next

fixed false test condition if index exists.