Fixed bugs caused by improper merging.