changed sql ifnull into coalesce