Fix implementation of sum to be compatible with major uses (requires at least one element).