Fix #11 add checks on displaying flash alerts