fix bug detecting the end of an incomplete log file