Merge "Make sure we handle the matrix separately for non-invertable matrix" into oc-dev