Fix bug that causes writer to write only the first character.