fixes for SD card logic