removed reversing of ranks when output matrix is to be produced.