Fixed bug for n_y>1