True, if id is list something is wrong. The code on github seems good, and my local copy here works good too. What exactly is old_chain? Are you sure it is a true chain? What is the content of res.id?