fix retrieving previous substep

This threw an error on the console. I'm not certain this is the correct way to fix it, so please double check, but it seems to still work and the error is gone :)