fixes for the flash detect

fixes #1413, also fixes #1432