better IP update code