fix error about bad memory access by NSArray