Fix calling undefined array problem