with type check