Corrected sum function calling issue