fixes custom-index bug & adds test.