Call defer properly