diff --git a/src/calibre/ebooks/lrf/html/convert_from.py b/src/calibre/ebooks/lrf/html/convert_from.py
index 529b9dfdb8..2554d91f15 100644
--- a/src/calibre/ebooks/lrf/html/convert_from.py
+++ b/src/calibre/ebooks/lrf/html/convert_from.py
@@ -1920,7 +1920,7 @@ def process_file(path, options, logger=None):
options.anchor_ids = True
files = options.spine if (options.use_spine and hasattr(options, 'spine')) else [path]
conv = HTMLConverter(book, fonts, options, logger, files)
- if options.use_spine and hasattr(options, 'toc'):
+ if options.use_spine and hasattr(options, 'toc') and options.toc is not None:
conv.create_toc(options.toc)
oname = options.output
if not oname:
diff --git a/src/calibre/linux.py b/src/calibre/linux.py
index ab4afaf47f..81f288384f 100644
--- a/src/calibre/linux.py
+++ b/src/calibre/linux.py
@@ -422,7 +422,8 @@ def install_man_pages(fatal_errors):
raise
print 'Failed to install MAN pages as help2man is missing from your system'
break
- raw = re.compile(r'^\.IP\s*^([A-Z :]+)$', re.MULTILINE).sub(r'.SS\n\1', p.stdout.read())
+ o = p.stdout.read()
+ raw = re.compile(r'^\.IP\s*^([A-Z :]+)$', re.MULTILINE).sub(r'.SS\n\1', o)
if not raw.strip():
print 'Unable to create MAN page for', prog
continue