fixed bug that prevented the stack returning to its original parent