Bugfix unique constraint using index