fixed middleware inheritance