more clean shutdown fixes