fix issue 'recursive version calls iterative algorithm' lookup_loop