Zlib exception when calling response.free

this is the same issue as the one below and the fix provided works