Corre ct use of deprecated function 'has_key()' of dictionary