fix rule matching bug