fixed bug with json documents with no ending linefeed