Modified checkVariableDeclaration