Prevent potential crash
Improve wrapping of entities