Fixed NullPointerException caused when Android stops the service.