Fixed undefined variable refs