added check for root user when needed.