undefined variable ``$generator``