added a function to check for the existence of a dictionary key