Move sudo to only where needed to fix proxy issues