fixed bugs from the merge