Fixed file ownership bugs