diff --git a/tsg_tools/csv2btl/csv2btl.m b/tsg_tools/csv2btl/csv2btl.m
index 91171f750ba3332263b0fca3dd036bf5cc7fd985..517732d3a359c71ee2ffd6f0df90cecef22f0d1a 100644
--- a/tsg_tools/csv2btl/csv2btl.m
+++ b/tsg_tools/csv2btl/csv2btl.m
@@ -29,18 +29,12 @@ if (fid_ini ~= -1)
     
     % test the end-of-file
     % --------------------
-    while true
+    while ~feof(fid_ini)
         
         % read next line
         % --------------
         inputText = textscan(fid_ini, '%s', 1, 'delimiter', '\n');
         
-        % end of file, quit loop
-        % ----------------------
-        if feof(fid_ini)
-            break
-        end
-        
         for ii = {'repIn', 'repOut'}
             
             % get key, use char because i is cell
@@ -64,8 +58,7 @@ if (fid_ini ~= -1)
                 fprintf('%s -> %s\n', clef, cfg.(clef));
                 continue
             end
-        end
-        
+        end  
     end  % end of while loop
     
     % close .ini file