make the declaration outside of the loop.
no declaration in for
fix data segment permissions... allow to works with --enable-kvm
enable-kvm on qemu to spot more bugs