fix generatecode but