fix/improve unique indexes in db