Fixed IP lookup to work on both Linux and Mac(Darwin)