bug fixes; still slow as hell; think I need to change to c FILE* and fread and fwrite