Fixed a bug in variables checks