Fixed logic in helpers:get_flashed_messages