Fixed as_complex_pattern bug on dealing with compartments