bugfix: remove invalid JSON values on return in chain path