Fix handling of stack for leave, add to stack for autoenv_source_parent