Corrected variable check