Fixes bug create index