Replace deprecated calls to has() with contains()