Add the robust error checks for the compression program suggested at the end of Section 13.1.3.

Add the robust error checks for the compression program suggested at the end of Section 13.1.3.