Constructing coherent spatial memory in LLM agents through graph rectification