hard to find bug with countarray and max values