Fixed bugs after merging