Fixed a bug in least_cost_path, added a barebones test case.