Fixed IP detection bug