anchor.diff:    logical lInsUp
   ! run time variables
     integer iElUp, iElDw, ixApeUp, ixApeDw, jj, iuold
  -  logical lExtremes, lsame
  +  logical lAccrossLatticeExtremes, lsame
  +
  +! echo of input parameters
  +  write(lout,"(a)") ""
  +  write(lout,"(a,i0,a,i0,a,l)") "APER> Call to contour_aperture_markers - iUp=",itElUp," - iDw=",itElDw," - lInsUp=",lInsUp
   
   ! do not overwrite interface variables
     iElUp=itElUp
     iElDw=itElDw
  -! handling extremes of lattice structure?
  -  lExtremes=iElUp.eq.iu.and.iElDw.eq.1
  +! markers accross extremes of lattice structure?
  +  lAccrossLatticeExtremes=iElUp.gt.iElDw
   
   ! upstream marker
     iuold=iu
     call contour_aperture_marker( iElUp, lInsUp )
   ! the addition of the upstream aperture marker may have
   !    shifted by one the downstream entries
  -! NB: if lExtremes, the upstream marker is the last entry
  -!     in the lattice structure! Hence, no other entry is shifted!
  -  if( .not.lExtremes ) then
  +! NB: if lAccrossLatticeExtremes, the upstream marker is towards the end of
  +!     the lattice structure! Hence, the downstream marker is not shifted
  +  if( .not.lAccrossLatticeExtremes ) then
       if( iu-iuold.ne.0 ) then
         iElDw=iElDw+(iu-iuold)
         write(lout,"(a,i0)") "APER> ...inserted upstream marker - downstream entries shifted by ",iu-iuold
  
positive.code:  &                  'aper3[mm][rad]', 'aper4[mm][rad]', 'aper5[mm][rad]', 'aper6[mm][rad]', &
   &                  'aper7[mm][rad]', 'aper8[mm][rad]', 'angle[rad]', 'xoff[mm]', 'yoff[mm]'
    return
   1984 format (a1,a64,1x,a6,1x,12(1x,a15))
  end subroutine dump_aperture_header
  
  subroutine dump_aperture_xsecs
  
negative.code: 
  ! echo of input parameters
    write(lout,"(a)") ""
    write(lout,"(a,i0,a,l)") "APER> Call to contour_aperture_marker - i=",iEl," - lInsUp=",lInsUp
  
  ! check upstream element
    ixEl=ic(iEl)-nblo
  