Better empty ref handling