added flash-detection