update function to get ip address