refine typecheck method