Improved the way of getting local addresses