Fix several bugs in TONE. The wrapper is working now.