before switching to view