stats: Add check for empty refs.