[BUG] Corrected boolval function and change the logic