Fixed bug when generateButton is set to false