fixed some bugs in fin min path, done issue #4