temp fix for grouping by date in case a value is null, grouping now not happening correctly, refactoring required
minor changes