gen: fix casting nums to signed types