Check if value exists before trying to get it