ZIP fixes from #168, modified to keep the Windows build alive