fixed bug in error writer.