fix the null pointer on service stop