fixed to handle files in sdcard appropriately