fixed _generations function