fix retrieving previous substep

threw an error on the console
Merge pull request #1 from lucas-clemente/patch-1

fix retrieving previous substep