Add proper check before calling `stop()`