fix bugs, add select algorithms