Convert doStop call to preStop and  postStop