fix some type mismatches, add debugging relation