better flag detection and sound