Script works but doesn't handle PermissionErrors