The problem is that 0 is falsey, so when the caller passed in 0 as the desired index it was ignored.