added case where array is 1d