changes to make output compile
make c test environment compile again
emitted code fixes
fix the tuple refernces for join