Corrected conditional handling of flash message