modify check end file method