fix handling of last entry if there is none