moved variable check