fix NullPointerException if service has to restart