added more granulated exception handling to flash driver