Fixed some crashes due to changes in view hierarchy