added safety shutdown