Fixing up tests; making c wrapper play nicely with free