Undefined variable fixes