fix bug when file is bigger then total cache size