fixed encoded bug in sax, needs more testing