Fix 'cannot read length of undefined' in ChainFind