Fix debugging, tests pass