changed type check to use is instance