3.0 entity context fix

Fixes #4019