added EINTR support to sum