check if respond_to instead of !nil?