fix variable type in const folding functions