Generalise Ifstatement matching with $_contains

fix a bug