diff --git a/.travis.yml b/.travis.yml
index e1b9f62..0b6f2c8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -10,7 +10,7 @@ python:
   - "nightly"
 # command to install dependencies
 install:
-  - pip install pydbg
+  - pip install -e .
 # command to run tests
 script:
   - pytest -vv
diff --git a/pydbg.py b/pydbg.py
index 3695ef8..a5b06df 100644
--- a/pydbg.py
+++ b/pydbg.py
@@ -27,7 +27,10 @@ def dbg(exp):
     for i in reversed(inspect.stack()):
         if "dbg" in i.code_context[0]:
             var_name = i.code_context[0][
-                i.code_context[0].find("(") + 1 : i.code_context[0].find(")")
+                i.code_context[0].find("(")
+                + 1 : len(i.code_context[0])
+                - 1
+                - i.code_context[0][::-1].find(")")
             ]
             print(f"[{i.filename}:{i.lineno}] {var_name} = {exp}")
             break

diff --git a/tests/test_pydbg.py b/tests/test_pydbg.py
index 5b12508..bf91ea4 100644
--- a/tests/test_pydbg.py
+++ b/tests/test_pydbg.py
@@ -4,9 +4,6 @@ from pydbg import dbg
 from contextlib import redirect_stdout
 
 
-def something():
-    pass
-
 cwd = os.getcwd()
 
 def test_variables():
@@ -23,12 +20,19 @@ def test_variables():
         dbg(strType)
         dbg(boolType)
         dbg(NoneType)
+        dbg(add(1, 2))
 
-    want = f"""[{cwd}/tests/test_pydbg.py:21] intType = 2
-[{cwd}/tests/test_pydbg.py:22] floatType = 2.1
-[{cwd}/tests/test_pydbg.py:23] strType = mystring
-[{cwd}/tests/test_pydbg.py:24] boolType = True
-[{cwd}/tests/test_pydbg.py:25] NoneType = None
+    want = f"""[{cwd}/tests/test_pydbg.py:18] intType = 2
+[{cwd}/tests/test_pydbg.py:19] floatType = 2.1
+[{cwd}/tests/test_pydbg.py:20] strType = mystring
+[{cwd}/tests/test_pydbg.py:21] boolType = True
+[{cwd}/tests/test_pydbg.py:22] NoneType = None
+[{cwd}/tests/test_pydbg.py:23] add(1, 2) = 3
 """
 
-    assert out.getvalue() == want
+    assert out.getvalue()  == want
+
+
+def add(x, y):
+    return x + y
+

Parentheses aren't displayed correctly for functions
The closing parentheses around the function call is missing.
```
In [19]: def add(x, y):
    ...:     z = x + y
    ...:     return z
    ...:

In [20]: dbg(add(1, 2))
[<ipython-input-20-ac7b28727082>:1] add(1, 2 = 3
```
tests/test_pydbg.py::test_variables