fix a bug in the writers