uint8_t *fpga_config;
        uint32_t i;
        int ret;
-       uint8_t c;              
+       int c;          
        z_stream compressed_fpga_stream;
 
        fpga_config = malloc(num_infiles * FPGA_CONFIG_SIZE);
                        for(uint16_t k = 0; k < FPGA_INTERLEAVE_SIZE; k++) {
                                c = fgetc(infile[j]);
                                if (!feof(infile[j])) {
-                                       fpga_config[i++] = c;
+                                       fpga_config[i++] = c &0xFF;
                                } else if (num_infiles > 1) {
                                        fpga_config[i++] = '\0';
                                }
        compressed_fpga_stream.avail_in = i;
        compressed_fpga_stream.zalloc = fpga_deflate_malloc;
        compressed_fpga_stream.zfree = fpga_deflate_free;
+       compressed_fpga_stream.opaque = Z_NULL;
        
        ret = deflateInit2(&compressed_fpga_stream, 
                                                COMPRESS_LEVEL,
        compressed_fpga_stream.avail_out = DECOMPRESS_BUF_SIZE;
        compressed_fpga_stream.zalloc = fpga_deflate_malloc;
        compressed_fpga_stream.zfree = fpga_deflate_free;
+       compressed_fpga_stream.opaque = Z_NULL;
        
        ret = inflateInit2(&compressed_fpga_stream, 0);