check for nil before accesing the hash object