Fixing issues with join generation.