Fixes view controller hierarchy and balances appearance calls