Changed the way photo.gallery_pos is updated.