ajax encoding improvements