Added validation for null values