fix max_hops condition (contributed by lytboris@yandex-team.ru)