small fix for when index === 0, it should work, as 0 || undefined; returns undefined not 0.