fix ArrayIndexOutOfBoundsException in CharArrayWriter
organize packages