Allow compilation without zlib. Also fix a potential segfault if a cpout reading
fails...  Thanks to Dan Roe for the fixes here.