fix algorithm

ada