add debug messages to shutdown