Fixed an algorith mistake.