Fixed null pointer when stopping