update sortEntities() method of ConditionalBuffer and MouldAssemlyBuffer