Fixed entity reference creation