Fixed agents passing/getting stuck on boundaries.