Fix: genCast must call genVal