fixed bug with view toggling