diff --git a/README.md b/README.md
index 9f60f79..14abd61 100644
--- a/README.md
+++ b/README.md
@@ -333,7 +333,7 @@ SELECT * FROM my_table WHERE c1 > 10
   License (BSD 3-Clause License): https://github.com/ben-strasser/fast-cpp-csv-parser/blob/master/LICENSE
 
 - [Dragonbox](https://github.com/jk-jeon/dragonbox)
-  Author: Junekey Jeon
+  Author: Junekey Jeon
   License (Boost, Apache2-LLVM): 
https://github.com/jk-jeon/dragonbox/blob/master/LICENSE-Boost 
   https://github.com/jk-jeon/dragonbox/blob/master/LICENSE-Apache2-LLVM
 
diff --git a/prompt.py b/prompt.py
index b8ec8d1..33240eb 100644
--- a/prompt.py
+++ b/prompt.py
@@ -550,7 +550,8 @@ def prompt(running = lambda:True, next = lambda:input('> '), state = None):
                 continue
             elif q == 'r': # build and run
                 if state.server_mode == RunType.Threaded:
-                    qs = [ctypes.c_char_p(bytes(q, 'utf-8')) for q in cxt.queries if len(q)]
+                    enc = lambda q: 'latin-1' if q.startswith('O') else 'utf-8'
+                    qs = [ctypes.c_char_p(bytes(q, enc(q))) for q in cxt.queries if len(q)]
                     sz = len(qs)
                     payload = (ctypes.c_char_p*sz)(*qs)
                     state.payload = payload
diff --git a/reconstruct/ast.py b/reconstruct/ast.py
index c1e0c44..ae8e1e8 100644
--- a/reconstruct/ast.py
+++ b/reconstruct/ast.py
@@ -424,7 +424,7 @@ class projection(ast_node):
             else:
                 self.context.ccode = ''
                 if self.limit != 0 and not self.outfile:
-                    self.context.direct_output()
+                    self.context.direct_output(self.limit)
         
 class select_distinct(projection):
     first_order = 'select_distinct'
@@ -1554,8 +1554,7 @@ class passthru_sql(ast_node):
                 context.queries.append('Q' + sql.strip('\r\n\t ;') + ';')
                 lq = sq.lower()
                 if lq.startswith('select'):
-                    context.queries.append('O')
-
+                    context.direct_output()
 
 class user_module_function(OperatorBase):
     def __init__(self, name, nargs, ret_type, context : Context):
diff --git a/reconstruct/storage.py b/reconstruct/storage.py
index c8f5e69..840e9ac 100644
--- a/reconstruct/storage.py
+++ b/reconstruct/storage.py
@@ -250,8 +250,12 @@ class Context:
         self.ccode = ''
         self.finalize_query()
     
-    def direct_output(self):
-        self.queries.append('O')
+    def direct_output(self, limit = -1, sep = ' ', end = '\n'):
+        if type(limit) is not int or limit > 2**32 - 1 or limit < 0:
+            limit = 2**32 - 1
+        limit = limit.to_bytes(4, 'little').decode('latin-1')
+        self.queries.append(
+            'O' + limit + sep + end)
     
     def abandon_postproc(self):
         self.ccode = ''
diff --git a/server/server.cpp b/server/server.cpp
index 6514093..3b47f57 100644
--- a/server/server.cpp
+++ b/server/server.cpp
@@ -200,7 +200,7 @@ void print_monetdb_results(Server* srv, const char* sep = " ", const char* end =
     if (!srv->haserror() && srv->cnt && limit){
         char buffer[output_buffer_size];
         auto _res = static_cast (srv->res);
-        const auto& ncols = _res->ncols;
+        const auto ncols = _res->ncols;
         monetdbe_column** cols = static_cast(malloc(sizeof(monetdbe_column*) * ncols));
         prt_fn_t *prtfns = (prt_fn_t*) alloca(sizeof(prt_fn_t) * ncols);
         char** col_data = static_cast (alloca(sizeof(char*) * ncols));
@@ -210,6 +210,7 @@ void print_monetdb_results(Server* srv, const char* sep = " ", const char* end =
         const size_t l_sep = strlen(sep);
         const size_t l_end = strlen(end);
         char* _buffer = buffer;
+        const auto cnt = srv->cnt < limit? srv->cnt : limit;
 
         for(uint32_t i = 0; i < ncols; ++i){
             err_msg = monetdbe_result_fetch(_res, &cols[i], i);
@@ -228,7 +229,7 @@ void print_monetdb_results(Server* srv, const char* sep = " ", const char* end =
 			header_string.resize(header_string.size() - l_sep - 1);
         header_string += end + std::string(header_string.size(), '=') + end;
         fputs(header_string.c_str(), stdout);
-        for(uint64_t i = 0; i < srv->cnt; ++i){
+        for(uint64_t i = 0; i < cnt; ++i){
             for(uint32_t j = 0; j < ncols; ++j){
                 //copy the field to buf
                 _buffer = prtfns[j](col_data[j], _buffer);
@@ -357,8 +358,13 @@ int dll_main(int argc, char** argv, Context* cxt){
                         case 'O':
                             {
                                 if(!server->haserror()){
+                                    uint32_t limit;
+                                    memcpy(&limit, n_recvd[i] + 1, sizeof(uint32_t));
+                                    printf("Limit: %x\n", limit);
+                                    if (limit == 0)
+                                        continue;
                                     timer.reset();
-                                    print_monetdb_results(server);        
+                                    print_monetdb_results(server, " ", "\n", limit);        
                                     cfg->stats.postproc_time += timer.elapsed();
                                 }
                             }