Fix bug in indexer - was confusing index and datatype