improve type check performance