fixed final bugs with multiple agents