replace-neighbors fix