fixes to scale to large pattern matching and sequence expressions