imporved exit behaviour