Fix deprecation warnings and make sure certain directories are owned by root