The array was being processed such that it would stop when it reached the number of row not the number of coloums.