Fix index out of bound (NC_inner, NC_P)