fixed middleware assignment