generalized #151 fix to hoisted functions and generators mode