fix defect in longest