Remove deconstructor and add assert to dynamic casting and return const address when creating entity.