replace isinstance with type