add basic shutdown handling