Fixed unique index bug