Set parent early to fix context problem with conditionals