Fix invalid variable value when executing again.
Refactor calling sub routine.