agent.cpp distance error fixed