added logging, fixed generator bug