Add patch from entity API's issue queue that fixes issue

From #2871.

Requires rebuild.