fix bug related to dx on boundary crossing

dx was computed in a wrong way for the boundary element.
Now we apply the offset g_span to correct this