We actually need to do a strict comparision here (`!== undefined`) otherwise it won't work correctly with first hop which number is 0 (falsy).