Fix func in before_request