Security: Fix to avoid DoesNotExist on query