Get order of matrices right