groupby being missused or a bug?