better protection against undefined and null values