middleware tweak