Fixes view controller hierarchy issues