implementing consistency check in the Writer class