diff --git a/bot/reviewbot/processing/review.py b/bot/reviewbot/processing/review.py
index a7f1cbd1f393cf754bbf14b24356090c4ba4dd04..d893dee656a22a4feb74163378d6fc4bf3c5e5d7 100644
--- a/bot/reviewbot/processing/review.py
+++ b/bot/reviewbot/processing/review.py
@@ -108,7 +108,12 @@ class File(object):
             return None
 
         try:
-            return self._api_filediff.get_patched_file().data
+            contents = self._api_filediff.get_patched_file().data
+
+            if isinstance(contents, six.text_type):
+                contents = contents.encode('utf-8')
+
+            return contents
         except APIError as e:
             if e.http_status == 404:
                 # This was a deleted file, a deleted FileDiff entry,
@@ -138,7 +143,12 @@ class File(object):
             return None
 
         try:
-            return self._api_filediff.get_original_file().data
+            contents = self._api_filediff.get_original_file().data
+
+            if isinstance(contents, six.text_type):
+                contents = contents.encode('utf-8')
+
+            return contents
         except APIError as e:
             if e.http_status == 404:
                 # This was a deleted FileDiff entry, or something has gone
@@ -306,7 +316,7 @@ class File(object):
                                    source_file, dest_file, self.id)
 
             with open(dest_file, 'wb') as fp:
-                fp.write(self.patched_file_contents)
+                fp.write(self.patched_file_contents or b'')
 
         self.patched_file_path = self.dest_file
 
diff --git a/bot/reviewbot/tools/pmd.py b/bot/reviewbot/tools/pmd.py
index d9b9054f7275e860d57d964c3ffb3234f11886d6..6e9b20eb379995043c4a075dd5fcd7b270c82690 100644
--- a/bot/reviewbot/tools/pmd.py
+++ b/bot/reviewbot/tools/pmd.py
@@ -180,11 +180,14 @@ class PMDTool(JavaToolMixin, FilePatternsFromSettingMixin, BaseTool):
 
             return
 
-        # Make sure there's only a single file. If not, something went wrong,
-        # but there isn't really anything the user can do about it. The
+        # Make sure there's only a single file, at most. If not, something went
+        # wrong, but there isn't really anything the user can do about it. The
         # administrator will need to look into it.
         files = report.get('files', [])
 
+        if not files:
+            return
+
         if len(files) != 1:
             self.logger.error('Expected 1 file in PMD output. Got %s: %r',
                               len(files), files)
diff --git a/bot/reviewbot/tools/shellcheck.py b/bot/reviewbot/tools/shellcheck.py
index 38c081adc7d7682893a279dcf3da77a67d50fa34..a8d72da43e58d1dc8972e5cf667047a6d078ef18 100644
--- a/bot/reviewbot/tools/shellcheck.py
+++ b/bot/reviewbot/tools/shellcheck.py
@@ -82,7 +82,7 @@ class ShellCheckTool(BaseTool):
         return (
             super(ShellCheckTool, self).get_can_handle_file(review_file,
                                                             **kwargs) or
-            self.SHELL_RE.match(review_file.patched_file_contents)
+            self.SHELL_RE.match(review_file.patched_file_contents or b'')
         )
 
     def build_base_command(self, **kwargs):
