Fixed a bug caused by conflicting definitions of sum()