Fix "Undefined variable: ex"