fixed xs middleware bug