Change encoding of strings before writing as json

This saves from occasional encoding errors
Check if Invoker is running via ping if running