Fix a bug of pattern assignments.