fixed bug in max_flow