Cl/offsite middleware bugfix

See note on issue #744