perjarle:
I am using Arduino IDE 1.0.1 for Windows
Please note that in versions of the IDE up to and including 1.0.3, the String library has bugs as discussed here and here.
In particular, the dynamic memory allocation used by the String class may fail and cause random crashes.
I recommend reworking your code to manage without String. Use C-style strings instead (strcpy, strcat, strcmp, etc.), as described here for example.
Alternatively, install the fix described here: Fixing String Crashes
Preferably upgrade your IDE to version 1.0.4 or above at: http://arduino.cc/en/Main/Software