Fix a bug caused by a wrong variable value