Fixed OSError deprecation warnings.