Added handling to make sure all rows have the same length.