Remove exception in method registerPattern.
Fix special char in querId problem.
CleanUp.
For tests use local middleware.