Fix how to check service running

Fix for #264.

Please see the details in the code comment.