fixed bug while finding longest match, make sure zero's found at start are not the same