Added the statement return to condition: if res.nil?