fixed bugs from merging