issue #5213: fix matrix to affine converting bug