fix error: Can't use an undefined value as an ARRAY reference