better runtime shutdown handling