fixed algorithm add