Fix problem when flash messages object is nil