Fixed undefined variables

Fixed undefined variables