Fixed null references in Entity.