fixed example to check if the session exists when getting flash messages to avoid starting sessions when not needed