Fix array count calculation bug.