Fixing to handle nested nodes