only call entity_exists in debug mode (introduced in this commit)

It's only a check anyway. Ok @dodijk.