add val check and const fold process