Fix matrix matching, update contains->in usage