bugfix for shutdown