was checking wrong variable