update patch for core check_plain function