switch to fread/fopen and popen(gzip)