FIX Undefined variable: q