fixed stop function