Fix some tests, add debugging