diff --git a/pyls/_utils.py b/pyls/_utils.py
index fb353c3..56a8630 100644
--- a/pyls/_utils.py
+++ b/pyls/_utils.py
@@ -104,5 +104,5 @@ def format_docstring(contents):
 def clip_column(column, lines, line_number):
     # Normalise the position as per the LSP that accepts character positions > line length
     # https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md#position
-    max_column = len(lines[line_number]) - 1 if len(lines) > line_number else 0
+    max_column = len(lines[line_number].rstrip('\r\n')) if len(lines) > line_number else 0
     return min(column, max_column)
diff --git a/pyls/python_ls.py b/pyls/python_ls.py
index 61de356..e1c9297 100644
--- a/pyls/python_ls.py
+++ b/pyls/python_ls.py
@@ -32,7 +32,7 @@ class _StreamHandlerWrapper(socketserver.StreamRequestHandler, object):
 
 
 def start_tcp_lang_server(bind_addr, port, handler_class):
-    if not isinstance(handler_class, PythonLanguageServer):
+    if not issubclass(handler_class, PythonLanguageServer):
         raise ValueError('Handler class must be an instance of PythonLanguageServer')
 
     # Construct a custom wrapper class around the user's handler_class

TCP mode is not working since v0.15.0
When I attempt to start the language server in TCP mode using the command

``` pyls --tcp --host 127.0.0.1 --port 7003 ```

it fails to start the language server with the error ```Handler class must be an instance of PythonLanguageServer```
diff --git a/test/test_utils.py b/test/test_utils.py
index 6675374..9d00686 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -52,6 +52,12 @@ def test_merge_dicts():
 
 
 def test_clip_column():
-    assert _utils.clip_column(5, ['123'], 0) == 2
-    assert _utils.clip_column(2, ['\n', '123'], 1) == 2
     assert _utils.clip_column(0, [], 0) == 0
+    assert _utils.clip_column(2, ['123'], 0) == 2
+    assert _utils.clip_column(3, ['123'], 0) == 3
+    assert _utils.clip_column(5, ['123'], 0) == 3
+    assert _utils.clip_column(0, ['\n', '123'], 0) == 0
+    assert _utils.clip_column(1, ['\n', '123'], 0) == 0
+    assert _utils.clip_column(2, ['123\n', '123'], 0) == 2
+    assert _utils.clip_column(3, ['123\n', '123'], 0) == 3
+    assert _utils.clip_column(4, ['123\n', '123'], 1) == 3

pip install -e .[test]
parse_log_pytest
requirements.txt
pytest
apt-get update apt-get install -y gcc
3.9
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
cachetools==5.5.2
chardet==5.2.0
colorama==0.4.6
configparser==7.2.0
coverage==7.8.0
distlib==0.3.9
exceptiongroup==1.2.2
filelock==3.18.0
future==1.0.0
iniconfig==2.1.0
jedi==0.19.2
json-rpc==1.10.8
mccabe==0.7.0
mock==5.2.0
packaging==24.2
parso==0.8.4
platformdirs==4.3.7
pluggy==1.5.0
pycodestyle==2.13.0
pydocstyle==6.3.0
pyflakes==3.3.1
pyproject-api==1.9.0
pytest==8.3.5
pytest-cov==6.0.0
-e git+https://github.com/palantir/python-language-server.git@67811f275c8ce61dea78400e2b202bf7f5dc4707#egg=python_language_server
pytoolconfig==1.3.1
rope==1.13.0
snowballstemmer==2.2.0
tomli==2.2.1
tox==4.25.0
typing_extensions==4.13.0
versioneer==0.29
virtualenv==20.29.3
yapf==0.43.0

name: python-language-server
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - cachetools==5.5.2
      - chardet==5.2.0
      - colorama==0.4.6
      - configparser==7.2.0
      - coverage==7.8.0
      - distlib==0.3.9
      - exceptiongroup==1.2.2
      - filelock==3.18.0
      - future==1.0.0
      - iniconfig==2.1.0
      - jedi==0.19.2
      - json-rpc==1.10.8
      - mccabe==0.7.0
      - mock==5.2.0
      - packaging==24.2
      - parso==0.8.4
      - platformdirs==4.3.7
      - pluggy==1.5.0
      - pycodestyle==2.13.0
      - pydocstyle==6.3.0
      - pyflakes==3.3.1
      - pyproject-api==1.9.0
      - pytest==8.3.5
      - pytest-cov==6.0.0
      - pytoolconfig==1.3.1
      - rope==1.13.0
      - snowballstemmer==2.2.0
      - tomli==2.2.1
      - tox==4.25.0
      - typing-extensions==4.13.0
      - versioneer==0.29
      - virtualenv==20.29.3
      - yapf==0.43.0
prefix: /opt/conda/envs/python-language-server

test/test_utils.py::test_clip_column
test/test_utils.py::test_debounce test/test_utils.py::test_list_to_string test/test_utils.py::test_camel_to_underscore test/test_utils.py::test_find_parents test/test_utils.py::test_merge_dicts
pyls/_utils.py pyls/python_ls.py
pyls/_utils.py pyls/python_ls.py