fix wrong array size access