fixes array count issues