checking all writes.
renamed ColorWriter's field w to writer
returning length of originally passed in bytes