Fix issue with view switching