Bug fix in matchPattern_v2