     m64File.seekSet(0x018);
   
     // Open header
-    int32_t newNumFrames;
+    uint32_t newNumFrames;
     if (m64File.read(&newNumFrames, 4) != 4) {
         m64File.close();
         Serial.println(F("E:Failed to read frame count"));

    startTimer();
    volatile uint32_t *config = portConfigRegister(N64_PIN);
    uint32_t oldConfig = *config;
//    unsigned int curPos;

    // Bail if file open failed
    if (!m64OpenSuccess)
        goto end;

    *config &= ~0x000F0000;


    size_t writePos = getNextRegion(writeLen);
    if (writeLen > dataLeft)
      writeLen = dataLeft;
    if (writeLen) {
      memcpy(inputBuffer + writePos, data.c_str() + totalWritten, writeLen);
      totalWritten += writeLen;
      noInterrupts();
      finished = false;
      bufferEndPos = writePos + writeLen;
      bufferHasData = true;
      interrupts();
    }
  } while (writeLen > 0);
  return totalWritten;
}
