Move sudo check further up.