Fixed assorted bugs in test_algo