Fixed a bug getting the root entity.