updating script to prevent stack overflow on 32 bit systems