optimization in writeLongString() and fix size for nprintf()