fix algorithm to build