improved accuracy of IP check