fixed nat and global code