Detect correctly when running with sudo