finish check redeclaration and check undeclaration