Fix constant folding returning boolean values

Performance issue as some part of the code was not expanded.