fixed an issue where sum not being initialized caused issues