Fix syntax errors, add some debug output.