Defer after checking for errors