Fix #226

This should fix #226. Basically, we inlined without copying. Thus selects were pushed into both the original and inlined copy even if they were in different parts of the subtree.