Fixes abstract database group by bucket calculation and key