fixed the remaining bugs from the merge