Fixed two of the three failed tests.

Two of the three test failures were caused by bugs in the testing code.
Only failure of Test 1 (get_length) remains to be fixed.