Fixed bugs after merge