Update helpers.R

Debugged indexing problem.