Fixed bugs caused by merging