finally get shutdown working