Fixed a bug caused by when entity is dead