Added some better error reporting when type not in index.