Improve the spawn code generation to avoid crashing in 32 bit mode