fix indexing with undefined property