[#1743] Fetch list of flash messages from the loop itself to avoid issues with variables and block scopes.