update postion function