Added conditional for handling arrays of shape (x, 1)