move the completionHandler after nil check