ticket:3 fixed model for middleware and tests