debugging in update image function