add middleware