Fix recursion detection when rendering variables

Fixes #285