Fix IP location code bugs found in oracle testing