diff --git a/upy.py b/upy.py
index 3b0365fc1e54d86e89cadc70a3785a0c47dcd547..1abbe3a81c794edffe80f63cec3fa06b12c84a92 100755
--- a/upy.py
+++ b/upy.py
@@ -31,6 +31,7 @@ s.write(b'\x01') # ^a enter raw mode
 while (s.in_waiting > 0): # clear buffer
    s.read()
 if (sys.argv[2] == 'run'):
+   s.write(b'\x04') # ^d reset
    s.write(b'\x03') # ^c interrupt
    file = open(sys.argv[3],'r')
    str = file.read()
@@ -42,6 +43,7 @@ if (sys.argv[2] == 'run'):
    while (True): # show output
       sys.stdout.write(s.read().decode('utf-8'))
 elif (sys.argv[2] == 'ls'):
+   s.write(b'\x04') # ^d reset
    s.write(b'\x03') # ^c interrupt
    s.write(b'import os\n')
    s.write(b'files = os.listdir()\n')
@@ -54,6 +56,7 @@ elif (sys.argv[2] == 'ls'):
       sys.stdout.write(s.read().decode('utf-8'))
    print('')
 elif (sys.argv[2] == 'put'):
+   s.write(b'\x04') # ^d reset
    s.write(b'\x03') # ^c interrupt
    file = open(sys.argv[3],'r')
    str = file.read()
@@ -72,6 +75,7 @@ elif (sys.argv[2] == 'put'):
       sys.stdout.write(s.read().decode('utf-8'))
    print('')
 elif (sys.argv[2] == 'get'):
+   s.write(b'\x04') # ^d reset
    s.write(b'\x03') # ^c interrupt
    s.write(bytes(f'file = open("{sys.argv[3]}","r")\n','ascii'))
    s.write(b'print(file.read())\n')