Adding a check for the variable type