minor fixes for json sending code.