refine typecheck method.