Better shutdown behaviour