Fix script wrapping with AMD struc and global fallback