Fix implicit coercion of aggregation and window functions