modify stop function