fixed #4697. fix bad variable reference