Fix unit test, Add generated index for insertion, add specific
exception.