Fixed bugs from merging