making progress, error in sum function somewhere