fix a bug caused by empty result
fix a bug in aggregate pct