diff --git a/Dockerfile b/Dockerfile
index 012a1259..993ac012 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,5 +1,4 @@
 FROM python:2.7
-MAINTAINER Joffrey F <joffrey@docker.com>
 
 RUN mkdir /home/docker-py
 WORKDIR /home/docker-py
diff --git a/Dockerfile-py3 b/Dockerfile-py3
index 21e713bb..c7466517 100644
--- a/Dockerfile-py3
+++ b/Dockerfile-py3
@@ -1,5 +1,4 @@
 FROM python:3.5
-MAINTAINER Joffrey F <joffrey@docker.com>
 
 RUN mkdir /home/docker-py
 WORKDIR /home/docker-py
diff --git a/docker/api/image.py b/docker/api/image.py
index 2c8cbb23..c1ebc69c 100644
--- a/docker/api/image.py
+++ b/docker/api/image.py
@@ -469,6 +469,11 @@ class ImageApiMixin(object):
         Raises:
             :py:class:`docker.errors.APIError`
                 If the server returns an error.
+
+        Example:
+
+            >>> client.tag('ubuntu', 'localhost:5000/ubuntu', 'latest',
+                           force=True)
         """
         params = {
             'tag': tag,
diff --git a/docker/utils/socket.py b/docker/utils/socket.py
index 164b845a..4080f253 100644
--- a/docker/utils/socket.py
+++ b/docker/utils/socket.py
@@ -69,7 +69,11 @@ def frames_iter(socket):
     """
     Returns a generator of frames read from socket
     """
-    n = next_frame_size(socket)
-    while n > 0:
-        yield read(socket, n)
+    while True:
         n = next_frame_size(socket)
+        if n == 0:
+            break
+        while n > 0:
+            result = read(socket, n)
+            n -= len(result)
+            yield result
diff --git a/docker/utils/utils.py b/docker/utils/utils.py
index b107f22e..823894c3 100644
--- a/docker/utils/utils.py
+++ b/docker/utils/utils.py
@@ -735,9 +735,9 @@ def create_host_config(binds=None, port_bindings=None, lxc_conf=None,
 
         host_config['ShmSize'] = shm_size
 
-    if pid_mode not in (None, 'host'):
-        raise host_config_value_error('pid_mode', pid_mode)
-    elif pid_mode:
+    if pid_mode:
+        if version_lt(version, '1.24') and pid_mode != 'host':
+            raise host_config_value_error('pid_mode', pid_mode)
         host_config['PidMode'] = pid_mode
 
     if ipc_mode:
@@ -1052,7 +1052,11 @@ def parse_env_file(env_file):
             if line[0] == '#':
                 continue
 
-            parse_line = line.strip().split('=', 1)
+            line = line.strip()
+            if not line:
+                continue
+
+            parse_line = line.split('=', 1)
             if len(parse_line) == 2:
                 k, v = parse_line
                 environment[k] = v
diff --git a/setup.py b/setup.py
index edf4b0e5..3f2e3c4a 100644
--- a/setup.py
+++ b/setup.py
@@ -1,4 +1,5 @@
 #!/usr/bin/env python
+import codecs
 import os
 import sys
 
@@ -35,7 +36,7 @@ with open('./test-requirements.txt') as test_reqs_txt:
 
 long_description = ''
 try:
-    with open('./README.rst') as readme_rst:
+    with codecs.open('./README.rst', encoding='utf-8') as readme_rst:
         long_description = readme_rst.read()
 except IOError:
     # README.rst is only generated on release. Its absence should not prevent

diff --git a/tests/integration/api_build_test.py b/tests/integration/api_build_test.py
index 9ae74f4d..3dac0e93 100644
--- a/tests/integration/api_build_test.py
+++ b/tests/integration/api_build_test.py
@@ -15,7 +15,6 @@ class BuildTest(BaseAPIIntegrationTest):
     def test_build_streaming(self):
         script = io.BytesIO('\n'.join([
             'FROM busybox',
-            'MAINTAINER docker-py',
             'RUN mkdir -p /tmp/test',
             'EXPOSE 8080',
             'ADD https://dl.dropboxusercontent.com/u/20637798/silence.tar.gz'
@@ -32,7 +31,6 @@ class BuildTest(BaseAPIIntegrationTest):
             return
         script = io.StringIO(six.text_type('\n').join([
             'FROM busybox',
-            'MAINTAINER docker-py',
             'RUN mkdir -p /tmp/test',
             'EXPOSE 8080',
             'ADD https://dl.dropboxusercontent.com/u/20637798/silence.tar.gz'
@@ -54,7 +52,6 @@ class BuildTest(BaseAPIIntegrationTest):
         with open(os.path.join(base_dir, 'Dockerfile'), 'w') as f:
             f.write("\n".join([
                 'FROM busybox',
-                'MAINTAINER docker-py',
                 'ADD . /test',
             ]))
 
@@ -182,7 +179,6 @@ class BuildTest(BaseAPIIntegrationTest):
         with open(os.path.join(base_dir, 'Dockerfile'), 'w') as f:
             f.write("\n".join([
                 'FROM busybox',
-                'MAINTAINER docker-py',
                 'ADD . /test',
             ]))
 
diff --git a/tests/integration/api_container_test.py b/tests/integration/api_container_test.py
index a5be6e76..f09e75ad 100644
--- a/tests/integration/api_container_test.py
+++ b/tests/integration/api_container_test.py
@@ -361,13 +361,6 @@ class CreateContainerTest(BaseAPIIntegrationTest):
         host_config = inspect['HostConfig']
         self.assertIn('MemorySwappiness', host_config)
 
-    def test_create_host_config_exception_raising(self):
-        self.assertRaises(TypeError,
-                          self.client.create_host_config, mem_swappiness='40')
-
-        self.assertRaises(ValueError,
-                          self.client.create_host_config, pid_mode='40')
-
     def test_create_with_environment_variable_no_value(self):
         container = self.client.create_container(
             BUSYBOX,
diff --git a/tests/unit/api_build_test.py b/tests/unit/api_build_test.py
index 8146fee7..927aa974 100644
--- a/tests/unit/api_build_test.py
+++ b/tests/unit/api_build_test.py
@@ -11,7 +11,6 @@ class BuildTest(BaseAPIClientTest):
     def test_build_container(self):
         script = io.BytesIO('\n'.join([
             'FROM busybox',
-            'MAINTAINER docker-py',
             'RUN mkdir -p /tmp/test',
             'EXPOSE 8080',
             'ADD https://dl.dropboxusercontent.com/u/20637798/silence.tar.gz'
@@ -23,7 +22,6 @@ class BuildTest(BaseAPIClientTest):
     def test_build_container_pull(self):
         script = io.BytesIO('\n'.join([
             'FROM busybox',
-            'MAINTAINER docker-py',
             'RUN mkdir -p /tmp/test',
             'EXPOSE 8080',
             'ADD https://dl.dropboxusercontent.com/u/20637798/silence.tar.gz'
@@ -35,7 +33,6 @@ class BuildTest(BaseAPIClientTest):
     def test_build_container_stream(self):
         script = io.BytesIO('\n'.join([
             'FROM busybox',
-            'MAINTAINER docker-py',
             'RUN mkdir -p /tmp/test',
             'EXPOSE 8080',
             'ADD https://dl.dropboxusercontent.com/u/20637798/silence.tar.gz'
@@ -47,7 +44,6 @@ class BuildTest(BaseAPIClientTest):
     def test_build_container_custom_context(self):
         script = io.BytesIO('\n'.join([
             'FROM busybox',
-            'MAINTAINER docker-py',
             'RUN mkdir -p /tmp/test',
             'EXPOSE 8080',
             'ADD https://dl.dropboxusercontent.com/u/20637798/silence.tar.gz'
@@ -60,7 +56,6 @@ class BuildTest(BaseAPIClientTest):
     def test_build_container_custom_context_gzip(self):
         script = io.BytesIO('\n'.join([
             'FROM busybox',
-            'MAINTAINER docker-py',
             'RUN mkdir -p /tmp/test',
             'EXPOSE 8080',
             'ADD https://dl.dropboxusercontent.com/u/20637798/silence.tar.gz'
diff --git a/tests/unit/utils_test.py b/tests/unit/utils_test.py
index 57aa226d..19d52c9f 100644
--- a/tests/unit/utils_test.py
+++ b/tests/unit/utils_test.py
@@ -205,6 +205,19 @@ class HostConfigTest(unittest.TestCase):
                 version='1.24', isolation={'isolation': 'hyperv'}
             )
 
+    def test_create_host_config_pid_mode(self):
+        with pytest.raises(ValueError):
+            create_host_config(version='1.23', pid_mode='baccab125')
+
+        config = create_host_config(version='1.23', pid_mode='host')
+        assert config.get('PidMode') == 'host'
+        config = create_host_config(version='1.24', pid_mode='baccab125')
+        assert config.get('PidMode') == 'baccab125'
+
+    def test_create_host_config_invalid_mem_swappiness(self):
+        with pytest.raises(TypeError):
+            create_host_config(version='1.24', mem_swappiness='40')
+
 
 class UlimitTest(unittest.TestCase):
     def test_create_host_config_dict_ulimit(self):
@@ -465,10 +478,18 @@ class ParseEnvFileTest(unittest.TestCase):
     def test_parse_env_file_commented_line(self):
         env_file = self.generate_tempfile(
             file_content='USER=jdoe\n#PASS=secret')
-        get_parse_env_file = parse_env_file((env_file))
+        get_parse_env_file = parse_env_file(env_file)
         self.assertEqual(get_parse_env_file, {'USER': 'jdoe'})
         os.unlink(env_file)
 
+    def test_parse_env_file_newline(self):
+        env_file = self.generate_tempfile(
+            file_content='\nUSER=jdoe\n\n\nPASS=secret')
+        get_parse_env_file = parse_env_file(env_file)
+        self.assertEqual(get_parse_env_file,
+                         {'USER': 'jdoe', 'PASS': 'secret'})
+        os.unlink(env_file)
+
     def test_parse_env_file_invalid_line(self):
         env_file = self.generate_tempfile(
             file_content='USER jdoe')

attach is causing an "Invalid Argument" exception from os.read
``` python
stream = client.attach(container, stream=True, stdout=True, stderr=True)
for chunk in stream:
    pass
```

Results in:

```
  File "/Users/michael/work/oss/marina/marina/build.py", line 695, in watcher
    for chunk in stream:
  File ".venv/lib/python3.5/site-packages/docker/utils/socket.py", line 67, in frames_iter
    yield read(socket, n)
  File ".venv/lib/python3.5/site-packages/docker/utils/socket.py", line 25, in read
    return os.read(socket.fileno(), n)
OSError: [Errno 22] Invalid argument
```

Using docker-py 1.10.2 on OS X 10.11.6 with docker for mac 1.12.0-rc3. Reverting to 1.9.0 fixes the issue.

tests/unit/utils_test.py::HostConfigTest::test_create_host_config_pid_mode tests/unit/utils_test.py::ParseEnvFileTest::test_parse_env_file_newline
tests/unit/api_build_test.py::BuildTest::test_build_container tests/unit/api_build_test.py::BuildTest::test_build_container_custom_context tests/unit/api_build_test.py::BuildTest::test_build_container_custom_context_gzip tests/unit/api_build_test.py::BuildTest::test_build_container_invalid_container_limits tests/unit/api_build_test.py::BuildTest::test_build_container_pull tests/unit/api_build_test.py::BuildTest::test_build_container_stream tests/unit/api_build_test.py::BuildTest::test_build_container_with_container_limits tests/unit/api_build_test.py::BuildTest::test_build_container_with_named_dockerfile tests/unit/api_build_test.py::BuildTest::test_build_remote_with_registry_auth tests/unit/api_build_test.py::BuildTest::test_set_auth_headers_with_dict_and_auth_configs tests/unit/api_build_test.py::BuildTest::test_set_auth_headers_with_dict_and_no_auth_configs tests/unit/api_build_test.py::BuildTest::test_set_auth_headers_with_empty_dict_and_auth_configs tests/unit/utils_test.py::DecoratorsTest::test_update_headers tests/unit/utils_test.py::HostConfigTest::test_create_endpoint_config_with_aliases tests/unit/utils_test.py::HostConfigTest::test_create_host_config_invalid_cpu_cfs_types tests/unit/utils_test.py::HostConfigTest::test_create_host_config_invalid_mem_swappiness tests/unit/utils_test.py::HostConfigTest::test_create_host_config_no_options tests/unit/utils_test.py::HostConfigTest::test_create_host_config_no_options_newer_api_version tests/unit/utils_test.py::HostConfigTest::test_create_host_config_with_blkio_constraints tests/unit/utils_test.py::HostConfigTest::test_create_host_config_with_cpu_period tests/unit/utils_test.py::HostConfigTest::test_create_host_config_with_cpu_quota tests/unit/utils_test.py::HostConfigTest::test_create_host_config_with_dns_opt tests/unit/utils_test.py::HostConfigTest::test_create_host_config_with_isolation tests/unit/utils_test.py::HostConfigTest::test_create_host_config_with_kernel_memory tests/unit/utils_test.py::HostConfigTest::test_create_host_config_with_mem_reservation tests/unit/utils_test.py::HostConfigTest::test_create_host_config_with_oom_kill_disable tests/unit/utils_test.py::HostConfigTest::test_create_host_config_with_oom_score_adj tests/unit/utils_test.py::HostConfigTest::test_create_host_config_with_pids_limit tests/unit/utils_test.py::HostConfigTest::test_create_host_config_with_shm_size tests/unit/utils_test.py::HostConfigTest::test_create_host_config_with_shm_size_in_mb tests/unit/utils_test.py::HostConfigTest::test_create_host_config_with_userns_mode tests/unit/utils_test.py::UlimitTest::test_create_host_config_dict_ulimit tests/unit/utils_test.py::UlimitTest::test_create_host_config_dict_ulimit_capitals tests/unit/utils_test.py::UlimitTest::test_create_host_config_obj_ulimit tests/unit/utils_test.py::UlimitTest::test_ulimit_invalid_type tests/unit/utils_test.py::LogConfigTest::test_create_host_config_dict_logconfig tests/unit/utils_test.py::LogConfigTest::test_create_host_config_obj_logconfig tests/unit/utils_test.py::LogConfigTest::test_logconfig_invalid_config_type tests/unit/utils_test.py::KwargsFromEnvTest::test_kwargs_from_env_alternate_env tests/unit/utils_test.py::KwargsFromEnvTest::test_kwargs_from_env_empty tests/unit/utils_test.py::KwargsFromEnvTest::test_kwargs_from_env_no_cert_path tests/unit/utils_test.py::KwargsFromEnvTest::test_kwargs_from_env_tls tests/unit/utils_test.py::KwargsFromEnvTest::test_kwargs_from_env_tls_verify_false tests/unit/utils_test.py::KwargsFromEnvTest::test_kwargs_from_env_tls_verify_false_no_cert tests/unit/utils_test.py::ConverVolumeBindsTest::test_convert_volume_binds_compact tests/unit/utils_test.py::ConverVolumeBindsTest::test_convert_volume_binds_complete tests/unit/utils_test.py::ConverVolumeBindsTest::test_convert_volume_binds_empty tests/unit/utils_test.py::ConverVolumeBindsTest::test_convert_volume_binds_list tests/unit/utils_test.py::ConverVolumeBindsTest::test_convert_volume_binds_no_mode tests/unit/utils_test.py::ConverVolumeBindsTest::test_convert_volume_binds_unicode_bytes_input tests/unit/utils_test.py::ConverVolumeBindsTest::test_convert_volume_binds_unicode_unicode_input tests/unit/utils_test.py::ParseEnvFileTest::test_parse_env_file_commented_line tests/unit/utils_test.py::ParseEnvFileTest::test_parse_env_file_invalid_line tests/unit/utils_test.py::ParseEnvFileTest::test_parse_env_file_proper tests/unit/utils_test.py::ParseEnvFileTest::test_parse_env_file_with_equals_character tests/unit/utils_test.py::ParseHostTest::test_parse_host tests/unit/utils_test.py::ParseHostTest::test_parse_host_empty_value tests/unit/utils_test.py::ParseHostTest::test_parse_host_tls tests/unit/utils_test.py::ParseHostTest::test_parse_host_tls_tcp_proto tests/unit/utils_test.py::ParseHostTest::test_parse_host_trailing_slash tests/unit/utils_test.py::ParseRepositoryTagTest::test_index_image_no_tag tests/unit/utils_test.py::ParseRepositoryTagTest::test_index_image_sha tests/unit/utils_test.py::ParseRepositoryTagTest::test_index_image_tag tests/unit/utils_test.py::ParseRepositoryTagTest::test_index_user_image_no_tag tests/unit/utils_test.py::ParseRepositoryTagTest::test_index_user_image_tag tests/unit/utils_test.py::ParseRepositoryTagTest::test_private_reg_image_no_tag tests/unit/utils_test.py::ParseRepositoryTagTest::test_private_reg_image_sha tests/unit/utils_test.py::ParseRepositoryTagTest::test_private_reg_image_tag tests/unit/utils_test.py::ParseDeviceTest::test_dict tests/unit/utils_test.py::ParseDeviceTest::test_full_string_definition tests/unit/utils_test.py::ParseDeviceTest::test_hybrid_list tests/unit/utils_test.py::ParseDeviceTest::test_partial_string_definition tests/unit/utils_test.py::ParseDeviceTest::test_permissionless_string_definition tests/unit/utils_test.py::ParseBytesTest::test_parse_bytes_float tests/unit/utils_test.py::ParseBytesTest::test_parse_bytes_invalid tests/unit/utils_test.py::ParseBytesTest::test_parse_bytes_maxint tests/unit/utils_test.py::ParseBytesTest::test_parse_bytes_valid tests/unit/utils_test.py::UtilsTest::test_convert_filters tests/unit/utils_test.py::UtilsTest::test_create_ipam_config tests/unit/utils_test.py::UtilsTest::test_decode_json_header tests/unit/utils_test.py::SplitCommandTest::test_split_command_with_unicode tests/unit/utils_test.py::PortsTest::test_build_port_bindings_with_matching_internal_port_ranges tests/unit/utils_test.py::PortsTest::test_build_port_bindings_with_matching_internal_ports tests/unit/utils_test.py::PortsTest::test_build_port_bindings_with_nonmatching_internal_port_ranges tests/unit/utils_test.py::PortsTest::test_build_port_bindings_with_nonmatching_internal_ports tests/unit/utils_test.py::PortsTest::test_build_port_bindings_with_one_port tests/unit/utils_test.py::PortsTest::test_build_port_bindings_with_port_range tests/unit/utils_test.py::PortsTest::test_host_only_with_colon tests/unit/utils_test.py::PortsTest::test_non_matching_length_port_ranges tests/unit/utils_test.py::PortsTest::test_port_and_range_invalid tests/unit/utils_test.py::PortsTest::test_port_only_with_colon tests/unit/utils_test.py::PortsTest::test_split_port_invalid tests/unit/utils_test.py::PortsTest::test_split_port_no_host_port tests/unit/utils_test.py::PortsTest::test_split_port_range_no_host_port tests/unit/utils_test.py::PortsTest::test_split_port_range_with_host_ip_no_port tests/unit/utils_test.py::PortsTest::test_split_port_range_with_host_port tests/unit/utils_test.py::PortsTest::test_split_port_range_with_protocol tests/unit/utils_test.py::PortsTest::test_split_port_with_host_ip tests/unit/utils_test.py::PortsTest::test_split_port_with_host_ip_no_port tests/unit/utils_test.py::PortsTest::test_split_port_with_host_port tests/unit/utils_test.py::PortsTest::test_split_port_with_protocol tests/unit/utils_test.py::ExcludePathsTest::test_directory tests/unit/utils_test.py::ExcludePathsTest::test_directory_with_single_exception tests/unit/utils_test.py::ExcludePathsTest::test_directory_with_subdir_exception tests/unit/utils_test.py::ExcludePathsTest::test_directory_with_trailing_slash tests/unit/utils_test.py::ExcludePathsTest::test_directory_with_wildcard_exception tests/unit/utils_test.py::ExcludePathsTest::test_exclude_custom_dockerfile tests/unit/utils_test.py::ExcludePathsTest::test_exclude_dockerfile_child tests/unit/utils_test.py::ExcludePathsTest::test_exclude_dockerfile_dockerignore tests/unit/utils_test.py::ExcludePathsTest::test_no_dupes tests/unit/utils_test.py::ExcludePathsTest::test_no_excludes tests/unit/utils_test.py::ExcludePathsTest::test_question_mark tests/unit/utils_test.py::ExcludePathsTest::test_single_filename tests/unit/utils_test.py::ExcludePathsTest::test_single_filename_leading_dot_slash tests/unit/utils_test.py::ExcludePathsTest::test_single_filename_trailing_slash tests/unit/utils_test.py::ExcludePathsTest::test_single_subdir_single_filename tests/unit/utils_test.py::ExcludePathsTest::test_single_subdir_wildcard_filename tests/unit/utils_test.py::ExcludePathsTest::test_single_subdir_with_path_traversal tests/unit/utils_test.py::ExcludePathsTest::test_subdirectory tests/unit/utils_test.py::ExcludePathsTest::test_wildcard_exclude tests/unit/utils_test.py::ExcludePathsTest::test_wildcard_filename_end tests/unit/utils_test.py::ExcludePathsTest::test_wildcard_filename_start tests/unit/utils_test.py::ExcludePathsTest::test_wildcard_subdir_single_filename tests/unit/utils_test.py::ExcludePathsTest::test_wildcard_subdir_wildcard_filename tests/unit/utils_test.py::ExcludePathsTest::test_wildcard_with_exception tests/unit/utils_test.py::ExcludePathsTest::test_wildcard_with_wildcard_exception tests/unit/utils_test.py::TarTest::test_tar_with_directory_symlinks tests/unit/utils_test.py::TarTest::test_tar_with_empty_directory tests/unit/utils_test.py::TarTest::test_tar_with_excludes tests/unit/utils_test.py::TarTest::test_tar_with_file_symlinks tests/unit/utils_test.py::FormatEnvironmentTest::test_format_env_binary_unicode_value tests/unit/utils_test.py::FormatEnvironmentTest::test_format_env_no_value