Slot bindings are by value, so ?x1 refers to the value in slot x1 at the time the right hand side is entered. Replace the first and second modify, using the pattern
(bind ?tx1 (- ?x1 ?lowerx))
and
(bind ?ux1 ?tx1)
and the last modify becomes
(modify ?g
(x1 (+ ?ux1 ?lowerx)) ... )