fix Entity diff bug caused by php reference copying