Pull-request with patch and test cases will follow soon.
Also fixed generation to generate join column in correct table.