indexing encoding using id matrix is not necessary

need to change