fix entity already associated with another entity bug