fixes crash when tearing down view hierarchies