implemented type checking for variables