Fix 178 and 180

Hi Robert,

I reworked the earlier patch (see #178) to use the system's zlib according to your remarks in the previous pull request to use DUSE_SYSTEM_ZLIB.
This pull requests also fixes #180, as they should "go in" at the same time to avoid build errors.

Closes: #178 and #180