fix wrong variable check