Fix COUNT and MAX_BY to be decomposable