fixed for when output is a matrix with a single row