Fix bug in: algorithm tools in Python