replace NULL compare with type()