minor safety fixes in constant folding