Switched receiver and slice order in cumsum and added check for nil receiver