Fix checking if key is in dict