update flash message and fix team index bug