bug fix for exit check

fixed the recent bug which stopped the service.