Fixed undefined variable  warning