replace invalid haskey? method by has_key?