adding only if necessary
handle error when creating index
Merge pull request #70 from twillouer/correct_inner_index

Correct inner index