fixed updating wrong pointer