Fix bugs after merge