Fixed shutdown handler.