fix generate_prototype off by 1 causing prototypes to be omitted