fix performance issue for initialization