     }
     else if(equals(0,space,"REM")){}
     else{
-      do{
-        runCommand(0,space);
-        space = getSpace(space+1,bufSize);
-      }while(space >= 0);
+      runCommand(0,space);
+      while(space >= 0 && space < bufSize){
+        int nSpace = getSpace(space+1,bufSize);
+        if(nSpace == -1) nSpace = bufSize;
+        runCommand(space+1,nSpace);
+        space = nSpace;
+        delay(5);
+      }
     }
   }
   

#include <SD.h>
#include "Keyboard.h"

//#define debug true // <-- uncomment to turn serial output on
#define CSpin 4 //Chip-Select of the SD-Card reader
#define buffersize 256


void runCommand(int s, int e){

  #ifdef debug 
    Serial.println("Press '"+String(buf).substring(s,e)+"'");
  #endif
  
  if(s == e) Keyboard.press(buf[s]);
