fix bug in max N in array