fix entity references