fix issue with non-unique indexes. #40