fix process running check to use proper return code check