More bulletproof bootstrap script