can only register a final middleware once