ticket:2 middleware bug fixed