bug fixes on IS NOT NULL join condition