Fixed incorrect merges, fixed tests