Fix a bug of pattern assignments.
Fix a bug on the special pattern '^'.
Update tests.