Fix accesses to undefined array