handle 1D case