Correctly handle DoesNotExist exceptions.