Fixed index bug on save