Fixed a seg fault in Writer