Fixed reading log files with invalid chars at the end