replace assert with if for initialization