Fixed shutdown script