preserve state when view leaves scope