fix the shut down bug