Fix a reference cycle in the layout code.

Possible fix for #278. At the very least, it doesn't appear to break anything...