fixes to interthread comm and json decoding