added type check for instance variables