Fix bug that bellman_ford does not detect negative selfloops