typechecker: Check return type of aggregation functions against zero

Also fix a resulting mistake in K3Ring