Fixed bug with generator