Replace deprecated has with haskey