checkType function added