fix query in aggregate_history without arguments