Are you using the Card Detect pin on the SD socket?