fixed incorrect number of generated links