Added some code to get around some very yucky 'root' nonsense.