Fix inserting multiple copies of ignored elements

This could cause the form to become impossible to save after saving a few times as the number of duplicate ignored elements grew exponentially.
Fix error on ignore/retain in <head>
Merge pull request #238 from dimagi/133655-max-call-stack

Fix max call stack error/bug