fix wrong variable name which was causing a bug when debug was on