Fixing outer join and add test cases