Correct hoisting behaviour to only evaluate once

The variable hoisting method was not checking if the variable was being
hoisted before evaluating it, which was causing it to be evaluated
twice. Now it is not evaluated during the hoisting phase.