fixed bugs in Json.write_lexemes