fix aggregate for null values