bugfixes to pair iterator