Add the type to the unique index on prefix

Try this for solving issue 401.