Handle null values gracefully