fixing some aggregate type stuff