[Backport] Prevent some ObjectDoesNotExist exceptions
Merge branch 'master' into stable