fixed groupby function under summary()