fixed example to check if the session exists when getting flash messge