better shutdown behavior