Fix ip finding code