fix checking of type.